<!-- Phan khai bao bien cuc bo-->
<?php
$v_list_id = 0;
if(isset($_REQUEST['hdn_list_id'])){
	$v_list_id = $_REQUEST['hdn_list_id'];
}
$v_listtype_id = $arr_all_listtype['0']['0'];
if(isset($_REQUEST['hdn_listtype_id'])){
	$v_listtype_id = $_REQUEST['hdn_listtype_id'];
}
$v_filter = "";
if(isset($_REQUEST['hdn_filter'])){
	$v_filter= _replace_bad_char(trim($_REQUEST['hdn_filter']));
}	
// Luu ten style hien thoi
$v_current_style_name = "odd_row";
// Luu ten style tiep theo
$v_next_style_name = "";
// Luu ten form
$v_form_name = "f_dsp_all_list";
$v_goto_url = "list/list/index.php";
$v_count=sizeof($arr_all_list);
$v_current_item_id = '';
if (isset($_REQUEST['hdn_item_id'])){
	$v_current_item_id = $_REQUEST['hdn_item_id'];
}
?>
<!--bang chua tieu de cua form-->
<table width="99%" cellpadding="0" cellspacing="0">
	<tr>
		<td class="normal_title"><?php echo CONST_LIST_LIST_TITLE; ?>
			<a id="goto" href="" style=".color:white">#</a>
		</td>
	</tr>
</table>
<!-- bang chua cac tieu thuc loc-->
<table cellpadding="0" cellspacing="0" width="100%">
	<col width="45%"><col width="55%">
	<tr>
		<form action="index.php" name="<?php echo $v_form_name;?>" method="post">
		<input name="hdn_list_id" type="hidden" value="">
		<input name="hdn_item_id" type="hidden" value="">
		<input name="hdn_list_list_id" type="hidden" value="0">
		<input name="hdn_filter" type="hidden" value="<?php echo $v_filter; ?>">
		<input name="hdn_listtype_id" type="hidden" value="<?php echo $v_listtype_id; ?>">
		<input name="fuseaction" type="hidden" value="">
		<input name="hdn_max_order" type="hidden" value="0">
	</tr>
	<tr>
		<td align="left" class="normal_label"><?php echo CONST_LISTTYPE_LABEL;?>
			<select class="normal_selectbox" name="sel_listtype" style="width:85%"  onChange="sel_onclick(this,document.forms(0).hdn_listtype_id,'DISPLAY_ALL_LIST')">
            <?php echo _generate_select_option($arr_all_listtype,'0','0','2', $v_listtype_id);?>
         	</select>
		</td>
	</tr>
	<tr>
		<td class="normal_label" align="left"><?php echo CONST_LIST_LIST_FILTER_LABEL;?>
			<input type="text" class="normal_textbox" size="59" name="txt_filter_value" value="<?php echo $v_filter; ?>" onKeyDown="txt_filter_keydown()">
			<input type="button" class="small_button" name="btn_filter" value="<?php echo _CONST_FILTER_BUTTON; ?>" onClick="btn_filter_onclick(document.forms(0).hdn_filter,document.forms(0).txt_filter_value,'DISPLAY_ALL_LIST')">
		</td>	
	</tr>	
	<tr><td height="5"></td></tr>
</table>
<!-- Bat cac phim: F12=false; Insert=true; Delete=true, ESC=false; Enter=false -->
<div id="hotkey" onKeyDown="javascript:process_hot_key(false,true,true,false,false);">
<!--Bang noi dung chua danh sach cac linh vuc-->
<table class="list_table2" width="100%" cellpadding="0" cellspacing="0">
	<col width="5%"><col width="20%"><col width="40%"><col width="10%"><col width="15%">
	<tr class="header">
		<td align="center">#</td>
		<td align="center"><?php echo CONST_LIST_CODE_LABEL; ?></td>
		<td align="center"><?php echo CONST_LIST_NAME_LABEL; ?></td>		
		<td align="center"><?php echo CONST_ORDER_LABEL; ?></td>
		<td align="center"><?php echo _CONST_STATUS_COLUMN_HEADER; ?></td>
	</tr>
</table>	
<div style="overflow: auto; width: 100%; height:<?php echo _CONST_HEIGHT_OF_LIST ?>;padding-left:0px;margin:0px">
<table class="list_table2" width="100%" cellpadding="0" cellspacing="0">
	<col width="5%"><col width="20%"><col width="40%"><col width="10%"><col width="15%">
	<?php  
	if ($v_count>0){
		for($row_index = 0;$row_index< $v_count ;$row_index++){
			$v_list_id = $arr_all_list[$row_index]['PK_LIST'];
			$v_list_code = _replace_bad_char($arr_all_list[$row_index]['C_CODE']);
			$v_list_name = _replace_bad_char($arr_all_list[$row_index]['C_NAME']);
			$v_list_order = $arr_all_list[$row_index]['C_ORDER'];
			$v_list_status =$arr_all_list[$row_index]['C_STATUS'];
			if ($v_list_status==1){$v_list_status=_CONST_STATUS_COLUMN_ACTIVE_VALUE;}else{$v_list_status=_CONST_STATUS_COLUMN_INACTIVE_VALUE;}
			$v_url = "row_onclick(" . "document.forms(0).hdn_list_id"  . "," . $v_list_id . "," . "'DISPLAY_SINGLE_LIST','" . $v_goto_url . "')";
			if ($v_current_style_name == "odd_row"){
				$v_current_style_name = "round_row";
			}else{
				$v_current_style_name = "odd_row";
			}
			?>	
			<tr class="<?php echo $v_current_style_name ?>"> 
				<td align="center">
					<input type="checkbox" name="chk_list_id" value="<?php echo $v_list_id; ?>">
				</td>
				<td align="left" onclick="<?php echo $v_url ;?>" class="normal_label">
					<a name="<?php echo $v_list_id;?>"><?php echo $v_list_code; ?>&nbsp;</a>
				</td>
				<td align="left" onclick="<?php echo $v_url ;?>" class="normal_label">
					<a name="<?php echo $v_list_id;?>"><?php echo $v_list_name; ?>&nbsp;</a>
				</td>
				<td align="center" onclick="<?php echo $v_url ;?>">
					<a name="<?php echo $v_list_id;?>"><?php echo $v_list_order; ?>&nbsp;</a>
				</td>
				<td align="center" onclick="<?php echo $v_url ;?>" class="normal_label">
					<a name="<?php echo $v_list_id;?>"><?php echo $v_list_status; ?>&nbsp;</a>
				</td>
			</tr><?php 
		}
	}
	if ($v_current_style_name == "odd_row"){
		$v_next_style_name = "round_row";
	}else{
		$v_next_style_name = "odd_row";
	}
	echo _add_empty_row($v_count,_CONST_NUMBER_OF_ROW_PER_LIST,$v_current_style_name,$v_next_style_name,5);
	?>
</table>
</div>
<!--Table chua cac button-->
<table align="center">
	<tr><td height="5"></td></tr>
	<tr>
		<td><?php
			if ($v_is_granted_update){?>
				<input type="button" value="<?php echo _CONST_ADD_BUTTON; ?>" name="btn_add" class="normal_button" onClick="btn_add_onclick(document.forms(0).hdn_list_id, 'DISPLAY_SINGLE_LIST');"><?php
			}	
			if ($v_is_granted_delete){?>
				<input type="button" value="<?php echo _CONST_DELETE_BUTTON; ?>" name="btn_delete" class="normal_button" onClick="btn_delete_onclick(document.forms(0).chk_list_id,document.forms(0).hdn_list_list_id,'DELETE_LIST')"><?php
			}?>
		</td>
	</tr>
</table>
</div id="hotkey">
</form>
<Script>
	document.all.goto.href="#<? echo $v_current_item_id;?>";
	document.all.goto.click();
	document.forms(0).hdn_max_order.value  ='<?php echo $v_list_order;?>';
</Script>
	
